package com.guoxin.part1.chapter1;

/**
 * 模板方法
 *
 * @author guoxin
 * @date 2019/8/26
 */
public class TemplateMethod {
    public final void print(String message){
        System.out.println("##########");
        wrapPrint(message);
        System.out.println("##########");
    }

    public void wrapPrint(String message){

    }

    public static void main(String[] args) {
        TemplateMethod t1 = new TemplateMethod(){
            @Override
            public void wrapPrint(String message) {
                System.out.println("*"+message+"*");
            }
        };
        t1.print("Hello Thread");

        TemplateMethod t2 = new TemplateMethod(){
            @Override
            public void wrapPrint(String message) {
                System.out.println("+"+message+"+");
            }
        };
        t2.print("Hello Thread");
    }
}
